var ws = require("nodejs-websocket");

//ip + port
var server = ws.createServer(function(conn){
	conn.on("text", function (msg) {
		var who = conn.socket.remoteAddress;
		var i = 0;
        server.connections.forEach(function (conn) {
        	conn.sendText(who + "说：" + msg);
    	});
    });

    conn.on("close", function (code, reason) {
        console.log("Connection closed");
    });

    conn.on("error", function (code, reason) {
        console.log("异常关闭");
    });
});
server.listen("30000");
//swoole框架 golang